<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title>KLIPSE: a simple and elegant online cljs compiler and evaluator</title>
        <link rel='shortcut icon' type='image/x-icon' href='img/klipse.png' />
        <link rel="stylesheet" type="text/css" href="css/codemirror.css">
    </head>
    <body>
    <div class="clj" data-beautify-strings="true">
(require '[clojure.string :as s])
(def head (atom 0))

(defn to [n] 
  (let [h @head]
    (reset! head n)
    (->> (if (>= n h) (repeat (- n h) ">") (repeat (- h n) "<"))
         (s/join ""))))

(defn move [s d]
  (str (to s) "[" (to d) "+" (to s) "-" "]"))

(defn ffor [a] (str (to a) "["))
(defn nnext [a] (str (to a) "-]"))
(defn move [s d] (str (ffor s) (to d) "+" (nnext s)))

(move 2 30)
</div>
    <p> BF </p>
    <div class="brainfuck">
        +.
        +++.
        +++.
        +++++.
    </div>
<br>
<p> Multiplication </p>
    <div class="brainfuck">
        +++>+++++&lt; 
        [>>>+>+&lt;&lt;&lt;&lt;-]>>>>[&lt;&lt;&lt;&lt;+>>>>-]&lt;
        [&lt;&lt;
          [>>>+>+&lt;&lt;&lt;&lt;-]>>>>[&lt;&lt;&lt;&lt;+>>>>-]&lt;
            [&lt;&lt;+>>-]
            &lt;-]
            &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
            .>.>.>.
    </div>
 
    <p> Hello World!</p>
    <div class="brainfuck-txt">
        ++++++++++[&gt;+++++++&gt;++++++++++&gt;+++&gt;+&lt;&lt;&lt;&lt;-]&gt;++.&gt;+.+++++++..+++.&gt;++.&lt;&lt;+++++++++++++++.&gt;.+++.------.--------.&gt;+.&gt;
    </div>
  <p>Eval</p>
 <div class="brainfuck" data-gist-id="viebel/9d801a43100c6a88669b641501c2929c"></div>
       <script>
        window.klipse_settings = {
             codemirror_options_in: {
                lineWrapping: true,
                autoCloseBrackets: true
            },
            codemirror_options_out: {
                lineWrapping: true
            },
            selector: '.clj',
           selector_brainfuck: '.brainfuck',
            selector_brainfuck_txt: '.brainfuck-txt',
        };
        </script>
        <script src="/lib/mirror_extensions.js"></script>
        <script src="/fig/js/klipse.fig.js"></script>
    </body>
</html>
